/*
 * @fileoverview | 基于uni.setStorage的二次扩展
 * @Author: wangenci | 1764387002@qq.com
 * @version 0.1 | 2020-7-15 15:22:11 // Initial version.
 * @Date: 2020-7-15 15:22:11
*/
class appStorage {
	public setStorage (options: any): void {
		try{
			return options.data ? uni[`${options.type}StorageSync`](options.key, options.data) : uni[`${options.type}StorageSync`](options.key)
		}  catch (e) {
			return false;
		}
	}
	public set(key: any, data: any): void {
		const options: any = {};
		options.key = key;
		options.data = data;
		options.type = 'set';
		return this.setStorage(options);
	}
	public get (key: any): void {
		const options: any = {};
		options.key = key;
		options.type = 'get';
		return this.setStorage(options);
	}
	public remove(key: any): void {
		const options: any = {};
		options.key = key;
		options.type = 'remove';
		return this.setStorage(options);
	}
	public clear(): void {
		const options: any = {};
		options.type = 'clear';
		return this.setStorage(options);
	}
}
export default appStorage